<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <script src="https://unpkg.com/react@16/umd/react.development.js"></script>
        <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
        <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
        <style>
            .title{
                background-color: brown;
            }
        </style>
    </head>
    <body>
        <div id="test"></div>
    </body>
    <script type="text/babel">
        const myId = 'SunWuKong';
        const myData = 'XiYouJi';
        //1.创建虚拟dom
        const VDOM = (
            <div>
                <h2 className='title' id={myId.toLocaleLowerCase()}>
                    <span style={{color:'white',fontSize:'29px'}}>{myData.toLocaleLowerCase()}</span>
                </h2>
                <input type="button" value="点击" />
                <input type="text"></input>
                <good>good</good>
                <Good>没有注册组件将报错</Good>
            </div>
        )
        // 渲染虚拟dom
        ReactDOM.render(VDOM,document.getElementById('test')); 

        /* 
            jsx语法规则:
                1.定义虚拟dom是,不写引号'' 
                2.标签中混入js表达式时要用{}
                3.样式的类名指定不要用class,要用className
                4.内联样式,要用style={{key:value}}的像是去写
                5.只有一个根标签
                6.标签必须是闭合
                7.标签首字母
                    (1.若小写字母开头,则将该标签转为html中同名元素,若html中无该标签对应的同名元素,则报错
                    (2.若大写字母开头,react就去渲染对应的组件,若组件没有定义,则报错
        */
    </script>
</html>